// Copyright (c) 2017 Florian Klampfer <https://qwtel.com/>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

// <<<<< INLINE
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: var(--font-weight-heading);
  margin: 5rem 0 1rem;
}

h1, .h1 {
  font-size: 2rem;
  line-height: 1.3;
}

h2, .h2 {
  font-size: 1.5rem;
  line-height: 1.4;
}

h3, .h3 {
  font-size: 1.17em;
  line-height: 1.5;
}

h4, h5, h6, .h4, .h5, .h6 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

p {
  margin-top: 0;
  margin-bottom: 1rem;

  &.lead {
    font-size: 1.2em;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 0 1rem;
  }
}

ul, ol, dl {
  margin-top: 0;
  margin-bottom: 1rem;
}

ul, ol {
  padding-left: 1.25rem;
}

hr {
  @extend .color-transition;
  position: relative;
  margin: 3rem 0;
  border: 0;
  border-top: 1px solid var(--border-color);
}

.hr {
  @extend .color-transition;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}
// >>>>>

// <<<<< LINK
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .heading {
  text-rendering: optimizeLegibility;
}

h1 + h2, .h1 + .h2, h1 + .h2, .h1 + h2,
h2 + h3, .h2 + .h3, h2 + .h3, .h2 + h3,
h3 + h4, .h3 + .h4, h3 + .h4, .h3 + h4,
h4 + h5, .h4 + .h5, h4 + .h5, .h4 + h5,
h5 + h6, .h5 + .h6, h5 + .h6, .h5 + h6 {
  margin-top: 0;
}

dt, strong {
  font-weight: var(--font-weight-bold);
}

dd {
  margin-bottom: .5rem;
}

abbr {
  font-size: 85%;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;

  &[title] {
    cursor: help;
    border-bottom: 1px dotted var(--border-color);
  }
}

blockquote {
  @extend .color-transition;
  padding: .5rem 1rem;
  margin: .8rem 0;
  color: var(--text-muted);
  border-left: .25rem solid var(--border-color);

  &.lead {
    font-size: 1.2em;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    border-left-width: 0.4rem;
  }

  > p:last-child {
    margin-bottom: 0;
  }
}

.heading {
  font-weight: var(--font-weight-heading);
}

.fine {
  font-size: .83em;
}

.faded {
  @extend .color-transition;
  color: var(--text-muted);
}

.centered {
  text-align: center;
}


h1[id], h2[id], h3[id], h4[id], h5[id], h6[id] {
  position: relative;

  > .permalink {
    @media screen {
      border-bottom: none;
      opacity: 0;
      width: 1.5rem;
      text-align: center;
      float: right;
      transition: opacity 400ms;
      will-change: opacity;
    }

    @media screen and (min-width: $break-point-1 + 2em) {
      float: none;
      position: absolute;
      top: 0;
      left: -1.75rem;
    }

    @media print {
      display: none;
    }
  }

  &:hover > .permalink {
    opacity: 0.5;
  }

  & > .permalink:hover,
  & > .permalink:focus {
    opacity: 1;
    transition: opacity 200ms;
  }
}

@media print {
  h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, dt {
    page-break-inside: avoid;
    break-inside: avoid-page;
    page-break-after: avoid;
    break-after: avoid-page;
  }
}
// >>>>> LINK
